[ Intro ]   [
Lesson1
]   [ Lesson2 ]   [ Lesson3 ]   [ Lesson4 ]   [ Lesson5 ]   [ Lesson6 ]   [ Lesson7 ]   [ Lesson8 ]


Animations

 

As soon as any part of the unit moves comparing to the ground plate, there is animation code behind the movement. It might be aiming, walking or maybe wing folding for landing airplanes, but they all have in common of being executed by the same type of tags.

 

There are three dimensions in our three-dimensional world and eventual unit. All measured by three scales, three axis... Open a unit in 3DO Builder and turn it around so it look on you or simply place yourself in front of a mirror. 

 

The most simple axis is the Y-axis that goes from your head to your toes and decide how far up or down the unit's parts are placed. The next axis of use is the X-axis that goes from your or your unit's left or right to the opposite side and is very useful if you don't like both arms and legs of a unit to be centered in the middle. Finally, the Z-axis goes into the picture and out from it, roaming from your arse to that other part of your body on the other side.

 

Turn or Move

 

Imagine the three axis as poles going through you. There are now two ways of acting: You can either move a piece along an axis or turn it around one. If you want to look to the left or right, you are turning your head around the y-axis. If your head suddenly decides to hover a meter above your neck, it would move along the same axis. If you walk, you are probably moving along the z-axis (unless you have a very damaged walking style).

 

 

turn turret to y-axis <60> NOW;

 

This command tells the game engine to Turn the turret 60 degrees around the y-axis instantly. Note that the angles must be enclosed in between the < > brackets to be counted as degrees. Starting to catch it? We'll proceed.

 

 

turn turret to y-axis <-60> speed <30>;

wait-for-turn turret around y-axis;

 

In this case, the turret will turn 60 degrees around the y-axis (turning to the opposite side comparing to the previous example) with a speed of 30 degrees/second (meaning that the turning will take two seconds) and the script will not continue until the turret completes it's animation. Note that when you tell the engine to wait-for-turn, you must proceed writing around and not to as in the actual moving command. Proceeding onto moving codes:

 

 

move barrel to z-axis [-3] NOW;

 

This is a very usual recoil situation when the barrel is instantly blasted backward the very moment it fires the weapon. Note that when ordering moving, you have to place the move distance between square [ ] brackets instead of the sharp ones. The distances are very difficult to explain as they don't have any measurable lengths, but a rule of thumb is that a distance of one grid square in the 3DO Builder is equal to five points in the script. You can also check the distance by going to View -> Grid size in the same program.

 

 

move barrel to z-axis [-3] NOW;

sleep 100;

move barrel to z-axis [0] speed [1];

wait-for-move barrel along z-axis;

 

This is an almost complete recoil sequence that instantly throws back the barrel upon a shot, waits in that position for 0.1 seconds to give a feeling of power and then slowly returns to it's ordinary position. While it takes those three seconds to restore, the rest of current script section is paused (yet other functions as aiming runs as normal). Note that wait-for-move command is followed by along or you will get an error.

 

 

spin radar around y-axis speed <90> accelerate <0.5>;

 

Finally, there is one more way to animate turning that is used on all metal extractors, wind generators and radars. It gives in this case an order to turn the radar piece round and round faster and faster until it make one complete turn every fourth second. The first second, the radar is not moving, the next second it moves a half degree, then a whole degree and then one and a half degree and so on rotating faster and faster every second until the limit is reached. To stop a spinning piece, the stop-spin command is used. The acceleration part is not always needed, it can be removed from the spin function and it can be added to normal turn and move scripts.

 

Now remember your master/slave tree and take into account how moving of one piece can affect moving of others.


Congratulations, if you mastered this part, you can continue reading lesson 3.

Storm